package com.yan.lambda;

/**
 * @author taoge
 * @Date 2024/8/15 16:40
 * @Description
 */
public class Demo2 {
    public static void main(String[] args) {
        Demo2 demo2 = new Demo2();
        Dog dog = demo2::eat;
        Cat cat = Demo2::eat1;

        dog.eat();
        String eat = cat.eat();
        System.out.println(eat);
    }

    public void eat(){
        System.out.println("普通方法执行");
        System.out.println("狗吃骨头");
    }

    public static String eat1(){
        System.out.println("静态方法执行");
        return "猫吃鱼";
    }
}

@FunctionalInterface
interface Dog{
    void eat();
}

@FunctionalInterface
interface Cat{
    String eat();
}
